package com.yanqu.road.server.cmd.estatewar;

import com.yanqu.road.server.pb.EstateWarPb;
import com.yanqu.road.entity.estatewar.EstateWarRecord;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.player.EstateWarModule;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;
import com.yanqu.road.server.command.Cmd;

import java.util.List;

@Cmd(code = Protocol.S_ESTATE_WAR_RECORD, desc = "乔迁风云战斗记录")
public class EstateWarRecordCmd extends AbstractCommand {

	private List<EstateWarRecord> recordList;

	@Override
	public boolean parseData(YanQuMessage packet) throws Exception {
		return true;
	}

	@Override
	public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
		recordList = player.getModule(EstateWarModule.class).getRecordList();
	}

	@Override
	public void sendData(GamePlayer player) {
		player.sendPacket(Protocol.U_ESTATE_WAR_RECORD, EstateWarPb.parseEstateWarRecordListMsg(recordList));
	}
}
